var collector = (function ($,urlFunc) {
    var saveHistory = function (pageType,shopId,sourceId) {
        setTimeout(function(){
            var regShared=/sharedId=([\w\d_-]+)/.exec(location.href);
            var oldId = regShared?regShared[1]:"";
            var sharedId = oldId ? oldId : "";
            var token=g.storage.getToken();
            $.ajax({
                type: "post",
                url: urlFunc.format("api/shared/history") ,
                headers: {'token': token},
                data: {
                    sharedId:sharedId,
                    shopId: shopId,
                    pageType: pageType,
                    sourceId:sourceId?sourceId:0,
                    pageTitle: document.title,
                    pageDesc: "",
                    pageLink: location.href,
                    isApp:0,//控制来源是app还是微信的的
                    appId:"2",//app端配置好
                },
                dataType: "json",
                success: function (result) {

                },
                error: function () {
                    //alert("保存浏览历史信息失败")
                }
            });
        },1500)

    }
    return {
        history: saveHistory
    }
})($,g.url)
//调用方式
//页面类型 (1:下载页面 2:店铺详情页面 3 知识库详情页面 4店铺列表 5:全景 6：视频)
// collector.history(页面类型,店铺详情页的id,业务主键);下载页面浏览